﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Init {
    import flash.events.*;

    public class CompleteMonitor extends EventDispatcher {

        protected var dispatcherCount:int;
        protected var numCompleted:int;

        public function CompleteMonitor(){
            this.dispatcherCount = (this.numCompleted = 0);
        }
        public function addDispatcher(_arg1:IEventDispatcher):void{
            this.dispatcherCount = (this.dispatcherCount + 1);
            _arg1.addEventListener(Event.COMPLETE, this.onComplete);
        }
        protected function onComplete(_arg1:Event):void{
            this.numCompleted = (this.numCompleted + 1);
            if (this.numCompleted == this.dispatcherCount){
                dispatchEvent(new Event(Event.COMPLETE));
            };
        }
        public function getDispatcherCount():int{
            return (this.dispatcherCount);
        }

    }
}//package Init 
